<template>
    <div class="mycards">
            <div class="cardDetail">
                <img class="cardInfo"    :src="info.imageOne" alt="">
                <div class="nameInfo">
                    <!-- <img class="backgroundImg"  src="../../assets/image/logo2.png" alt=""> -->
                    <div class="nameImg">
                        <span>{{info.cardName}}</span>
                    </div>
                    <div class="cardCode">{{info.cardNumber}}</div>
                    <div class="zhe">{{info.deductionMoney}}折</div>
                </div>
            </div>
<div class="cardInfoDate">
      <div>
          <span>有效期至</span>
           <span>{{info.deadline|fromatDate('yyyy-MM-dd')}}</span>
      </div>
      <div>
          <span>余额</span>
           <span>￥{{info.effective? (info.availableMoney||0): 0 | currency }}</span>
      </div>
       <div>
          <span>折扣</span>
           <span>{{info.deductionMoney}}折</span>
      </div>
  </div>
  <div class="flag"></div>
   <router-link class="server" :to="{path:'/CardDetail/'+$route.params.id}">
      <span>查看明细</span>
      <i class="arrow"></i>
   </router-link>
   <div class="btnBuy" v-if="info.statusPay">
       <router-link :to="{path:'/memberRecharge',query:{id:$route.params.id}}">去充值</router-link>
   </div>
    </div>
</template>

<script>
export default {
  name: "hello",
  data() {
    return {
      id: "",
      info: {},
      pageNo: 1,
      pageSize: 10,
      orderList: [],
      hasmore: true
    };
  },
  components: {},
  mounted() {
    var self = this;
    self._ajax({
      url: self.fn.wyl + "card/cardDetail",
      method: "post",
      data: {
        id: self.$route.params.id
      },
      callback(db) {
        if (db.errorCode == 200) {
          self.info = db.datas;
        } else {
          self.fn.tip(db.msg);
        }
      }
    });
  },
  methods: {}
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
@import "../../assets/css/userCenter/index.scss";
@import "~@/assets/css/util";
.mycards {
  background-color: #fff;
  height: 100vh;
}
.flag {
  height: 0.75rem;
  background-color: #f2f2f2;
  margin: 0 -0.75rem;
}
.server {
  height: px2rem(120);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e6e6e6;
  padding-right: 0.75rem;
  margin-right: -0.75rem;
}
.cardDetail {
  position: relative;
  .cardInfo {
    border-radius: 0.3rem;
    vertical-align: middle;
    width: 100%;
    height: 9rem;
  }
  .nameInfo {
    // position: absolute;
    // height: 100%;
    width: 100%;
    // top: 0;
    // left: 0;
    // padding-left: 1rem;
    color: #000;
    text-align: left;
    .nameImg {
      line-height: 1.8rem;
      font-size: 1rem;
      font-weight: 300;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-left: 0.5rem;
      // padding-top: 2rem;
    }
    .cardCode {
      padding-top: 0.75rem;
      text-align: left;
      font-size: 0.65rem;
      line-height: 0.65rem;
      padding-left: 0.5rem;
    }
    .zhe {
      // 这里用定位是为了解决苹果手机的不兼容 显示
      position: absolute;
      bottom: 0.75rem;
      text-align: right;
      right: 1.25rem;
      font-size: 0.6rem;
    }
    > img.backgroundImg {
      margin-top: 1rem;
      width: 2.85rem;
      height: 0.6rem;
    }
    .erweimaImg {
      width: 1.4rem;
      height: 1.4rem;
      vertical-align: middle;
    }
  }
}
.cardInfoDate {
  display: flex;
  padding: px2rem(40) 0;
  background-color: #fff;
  > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    span {
      padding: px2rem(15) 0;
      @include sc(32,#333);
    }
    span:nth-child(1) {
      @include sc(32,#8c8c8c);
    }
    &:nth-child(2) {
      border-right: 1px solid #ececec;
      border-left: 1px solid #ececec;
      span:nth-child(2) {
        @include sc(32,#08bae3);
      }
    }
  }
}
.btnBuy {
  position: fixed;
  bottom: 2rem;

  border-radius: px2rem(44);
  background-color: #08bae3;
  width: 100%;
  height: px2rem(88);
  width: px2rem(640);
  left: px2rem(55);
  @include sc(32,#fff);
  a {
    @include flex_center();
    width: 100%;
    height: 100%;
  }
}
</style>
